﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormRegister.aspx.cs" Inherits="RegisterUser.WebFormRegister" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="javascript" type="text/javascript">
    function ShowMenu() {
        var buttons = document.getElementsByName("RadioButtonListJavaScript");
        if (buttons[0].checked) {
            document.getElementById("CheckBoxListMale").style.display = 'block';
            document.getElementById("DropDownListFemale").style.display = 'none';
        } else {
            document.getElementById("CheckBoxListMale").style.display = 'none';
            document.getElementById("DropDownListFemale").style.display = 'block';
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="Style.css" type="text/css" />    
</head>
<body>
    <form id="formRegister" runat="server">
    <div>
        Username:
        <asp:TextBox runat="server" ID="TextBoxUsername" ValidationGroup="LogIn"></asp:TextBox> 
        <asp:RequiredFieldValidator runat="server" ID="usernameValidator" 
            ErrorMessage="Username field is empty!" ControlToValidate="TextBoxUsername" ForeColor="Red" Text="*" /> <br />
        Enter password:
        <asp:TextBox runat="server" ID="TextBoxPassword" TextMode="Password" ValidationGroup="LogIn"></asp:TextBox> 
        <asp:RequiredFieldValidator ID="PasswordValidator" runat="server" 
            ErrorMessage="Password field is empty!" ControlToValidate="TextBoxPassword" ForeColor="Red" Text="*" /> <br />
        Re-enter password:
        <asp:TextBox runat="server" ID="TextBoxRepeatPass" TextMode="Password" ValidationGroup="LogIn"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RepeatPasswordValidator" runat="server" 
            ErrorMessage="Password field is empty!" ControlToValidate="TextBoxRepeatPass" ForeColor="Red" Text="*" /> 
        <asp:CompareValidator runat="server" ID="CompareValidatorPassword" 
            ErrorMessage="Passwords don't match!" ControlToValidate="TextBoxRepeatPass" 
            ControlToCompare="TextBoxPassword" ForeColor="Red" EnableClientScript="false"
            Display="Dynamic" /> <br />
        First name:
        <asp:TextBox runat="server" ID="TextBoxFirstName" ValidationGroup="PersonalInfo"></asp:TextBox> 
        <asp:RequiredFieldValidator ID="FirstNameValidator" runat="server" ForeColor="Red"
            ControlToValidate="TextBoxFirstName" ErrorMessage="First name field is empty!" Text="*"></asp:RequiredFieldValidator> <br />
        Last name:
        <asp:TextBox runat="server" ID="TextBoxLastName" ValidationGroup="PersonalInfo"></asp:TextBox> 
        <asp:RequiredFieldValidator ID="LastNameValidator" runat="server" ForeColor="Red"
            ControlToValidate="TextBoxLastName" ErrorMessage="Last name field is empty!" Text="*"></asp:RequiredFieldValidator> <br />
        Age:
        <asp:TextBox runat="server" ID="TextBoxAge" ValidationGroup="PersonalInfo"></asp:TextBox> 
        (18-81) 
        <asp:RangeValidator ID="AgeValidator" runat="server" 
            ControlToValidate="TextBoxAge" MinimumValue="18" MaximumValue="81"
            ForeColor="Red" ErrorMessage="Age must be between 18 and 81" Text="*" 
            SetFocusOnError="True" Type="Integer"></asp:RangeValidator> <br /> 
        E-mail:
        <asp:TextBox runat="server" ID="TextBoxEmail" ValidationGroup="PersonalInfo"></asp:TextBox> 
        <asp:RegularExpressionValidator ID="EmailValidator" runat="server"
            ControlToValidate="TextBoxEmail" ErrorMessage="E-mail is invalid!" 
            Text="Error!" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
            ForeColor="Red"></asp:RegularExpressionValidator> <br />
        Address:<br />        
        <asp:TextBox runat="server" ID="TextBoxAddress" TextMode="MultiLine" ValidationGroup="AddressInfo"></asp:TextBox> 
        <asp:RequiredFieldValidator runat="server" ID="AddressValidator" ForeColor="Red"
            ErrorMessage="Address is empty!" Text="*" ControlToValidate="TextBoxAddress"></asp:RequiredFieldValidator> <br />
        Phone:
        <asp:TextBox runat="server" ID="TextBoxPhone" ValidationGroup="AddressInfo"></asp:TextBox> 
        <asp:RegularExpressionValidator runat="server" ID="PhoneValidator" ControlToValidate="TextBoxPhone"
            ForeColor="Red" ErrorMessage="Phone format is not valid!" Text="*" 
            ValidationExpression="\+359\s?\d{3,9}"></asp:RegularExpressionValidator> <br />
        <asp:RadioButtonList ID="RadioButtonList" runat="server" 
            RepeatDirection="Horizontal" AutoPostBack="true"
            onselectedindexchanged="RadioButtonList_SelectedIndexChanged">
            <asp:ListItem Text="male" />
            <asp:ListItem Text="female" /> 
        </asp:RadioButtonList> <br />
        <asp:Panel ID="Panel" runat="server"></asp:Panel> <br />

        Java script: <br />
        <asp:RadioButtonList ID="RadioButtonListJavaScript" runat="server" RepeatDirection="Horizontal"
            onchange="ShowMenu()">
            <asp:ListItem Text="male" Value="m"></asp:ListItem>
            <asp:ListItem Text="female" Value="f" ></asp:ListItem>
        </asp:RadioButtonList>
        <asp:CheckBoxList ID="CheckBoxListMale" runat="server">
            <asp:ListItem Text="BMW"></asp:ListItem>
            <asp:ListItem Text="OPEL"></asp:ListItem>
            <asp:ListItem Text="Toyota"></asp:ListItem>
            <asp:ListItem Text="Mercedes"></asp:ListItem>
        </asp:CheckBoxList>
        <asp:DropDownList ID="DropDownListFemale" runat="server">
            <asp:ListItem Text="New Brasil" />
            <asp:ListItem Text="Elite" />
            <asp:ListItem Text="Dau Egburts" />            
        </asp:DropDownList> <br />

        <asp:CheckBox runat="server" ID="CheckBoxAccept" Text="I accept license agreements." 
            oncheckedchanged="checkBoxAccept_CheckedChanged" AutoPostBack="true" /> <br />
        <asp:Button runat="server" ID="ButtonRegister" Text="Register" Enabled="true" 
            onclick="ButtonRegister_Click" />
        
        <asp:ValidationSummary runat="server" ID="ValidationSummary" ForeColor="Red" />
    </div>
    </form>
</body>
</html>
